package com.yqg.manage.mapper;

import com.yqg.manage.entity.ArchiveBranchNode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author zxf
 * @since 2024-04-30
 */
@Mapper
public interface ArchiveBranchNodeMapper extends BaseMapper<ArchiveBranchNode> {

    @Select("SELECT * from archive_branch_node where archive_branch_node.node_id = #{archiveNodeId}")
    List<ArchiveBranchNode> findSimpleProgramNextNode(Integer archiveNodeId);

    @Select("SELECT * from archive_branch_node where archive_branch_node.routine_type_id != 1 and archive_branch_node.node_id = #{archiveNodeId}")
    List<ArchiveBranchNode> findOtherProgramNextNode(Integer archiveNodeId);

    @Select("select * from archive_branch_node where archive_branch_node.next_node_id = #{archiveNodeId} order by node_id desc")
    List<ArchiveBranchNode> findSimpleProgramLastNode(Integer archiveNodeId);

    @Select("select * from archive_branch_node where archive_branch_node.routine_type_id != 1 and archive_branch_node.next_node_id = #{archiveNodeId} order by node_id desc")
    List<ArchiveBranchNode> findOtherProgramLastNode(Integer archiveNodeId);

}
